package org.fly.controller.admin;

import org.fly.bean.AliSmsSetting;
import org.fly.controller.AbstractController;
import org.fly.service.AliSmsSettingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by rongzhao.zhu on 2018/4/17.
 */
@Controller
@RequestMapping("/admin/smsSetting/")
public class AdminAliSmsSettingController extends AbstractController {
    @Autowired
    AliSmsSettingService aliSmsSettingService;
    @RequestMapping(value = "save", produces = "application/json;charset=utf-8")
    @ResponseBody
    public String save(AliSmsSetting smsSetting, HttpServletRequest request){
        try {
            aliSmsSettingService.save(smsSetting);
            return toJSONString(SUCCESS);
        } catch (Exception e) {
            e.printStackTrace();
            return toExceptionString(e);
        }
    }
    @RequestMapping(value = "find",produces = "application/json;charset=utf-8")
    @ResponseBody
    public String find(){
        AliSmsSetting bean = aliSmsSettingService.find();
        return toJSONString(createDataTip(bean));
    }
}
